import os

mode = "n2c"  # name to code
archons_file = open("archons.txt", "r", encoding="utf-8")
archons_data = [
    tuple(x.replace("\n", "").split("-")) for x in archons_file.readlines()
]
archons_file.close()
slide_file = open("slide.tex", "r", encoding="utf-8")
slide_content = slide_file.read()
slide_file.close()
for pair in archons_data:
    if mode == "n2c":
        slide_content = slide_content.replace(pair[0], pair[1])
    elif mode == "c2n":
        slide_content = slide_content.replace(pair[1], pair[0])
os.remove("slide.tex")
slide_file = open("slide.tex", "w", encoding="utf-8")
slide_file.write(slide_content)
slide_file.close()
